package com.jerry.template.module.mainpage.shouye.fragment;

import android.support.v4.app.Fragment;
import android.widget.RadioGroup;

import com.jerry.template.R;
import com.jerry.template.base.BaseFragment;
import com.jerry.template.module.home.fragment.AttentionFragment;

import butterknife.BindView;

/**
 * Created by chenhuan on 2016/5/11.
 */

public class HomePageFragment extends BaseFragment{

    @BindView(R.id.topbtn_group)
    RadioGroup topGroup;

    public HomePageFragment()
    {

    }

    @Override
    protected int getLayoutId(){
        return R.layout.frag_shouye;
    }

    @Override
    protected void initViews(){

        getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.frame_shouye,BaseFragment.newInstance(HomePageDefaultFragment.class,null)).commit();

      topGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener(){
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId){
                Fragment fragment = null;
                switch(checkedId){
                    case R.id.jingxuan:
                        fragment = BaseFragment.newInstance(HomePageDefaultFragment.class,null);
                        getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.frame_shouye,fragment).commit();
                        break;
                    case R.id.guanzhu:
                        fragment = BaseFragment.newInstance(AttentionFragment.class,null);
                        getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.frame_shouye,fragment).commit();
                        break;
                    default:
                        break;
                }
            }
        });




    }

    @Override
    protected void loadData(){
    }


}
